<?php 
	require('../includes/manager_fns.php');
	$fileName = end(explode('/',$_SERVER['PHP_SELF']));
	$title = '订单管理'; 
	$act = $_REQUEST['act'];
	$id = $_REQUEST['id'];
	switch ($act){
				
		case 'del';//删除模块
			data_del('module','module_id',$id);
			break;
		
		
	}
	
	
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title ?></title>
<script src="js/manager.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F8F9FA;
}
-->
</style>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt"><?php echo $title ?></div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="left_txt">当前位置：<?php echo $title ?></td>
          </tr>
          <tr>
            <td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
              <tr>
                <td></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="10%" height="55" valign="middle"><img src="images/title.gif" width="54" height="55"></td>
                <td width="90%" valign="top"><span class="left_txt2">网站订单的管理</span><br>
                          <span class="left_txt2">包括</span><span class="left_txt3">订单的查看</span>。 </span></td>
              </tr>
            </table></td>
          </tr>
          
          
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table>
          
          <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <form name="addform" action="" method="post"/>
            <tr>
              <td colspan="6" align="center" bgcolor="#f2f2f2" class="left_txt"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                  <tr>
                    <td class="left_bt2" align="left">&nbsp;&nbsp;&nbsp;&nbsp;订单列表</td>
                  </tr>
              </table></td>
            </tr>
              <tr bgcolor="#f2f2f2">
              <th align="center" class="left_txt2">ID</th>
              <th align="center" class="left_txt2">订单号</th>
              <th align="center" class="left_txt2">产品名称</th>
              <th align="center" class="left_txt2">客户名</th>
              <th align="center" class="left_txt2">时间</th>
              <th align="center" class="left_txt2">&nbsp;</th>
              </tr>
            <?php 
            $conn = db_connect();
            $sql = 'SELECT * FROM `order` WHERE `order_type` = 1 ORDER BY `order_addtime` DESC';
            $stmt = $conn -> prepare($sql);
            $stmt -> execute();
            $vo = $stmt -> fetchall();
            $i = 0;
            foreach ($vo as $value){
            	$i += 1;
            	if (fmod($i,2) == 0){
            		$bgcolor = '#f2f2f2';
            	}else{
            		$bgcolor = '';
            	}
            	$sql1 = 'SELECT `product_name` FROM `product` WHERE `product_id` = :id';
            	$stmt1 = $conn -> prepare($sql1);
            	$stmt1 -> bindParam('id',$value['product_id']);
            	$stmt1 -> execute();
            	$vo1 = $stmt1 -> fetchColumn();
				
				$sql2 = 'SELECT `customer_name` FROM `customer` WHERE `customer_id` = :id';
            	$stmt2 = $conn -> prepare($sql2);
            	$stmt2 -> bindParam('id',$value['customer_id']);
            	$stmt2 -> execute();
            	$vo2 = $stmt2 -> fetchColumn();
            	
            ?>
            <tr bgcolor="<?php echo $bgcolor ?>">
              <td width="5%" align="center" class="left_txt2"><?php echo $value['order_id'];?></td>
              <td width="30%" align="center" class="left_txt2"><?php echo $value['order_number'];?></td>
              <td width="17%" align="center" class="left_txt"><?php echo $vo1;?></td>
              <td width="15%" align="center" class="left_txt2"><?php echo $vo2;?></td>
              <td width="25%" align="center" class="left_txt"><?php echo $value['order_addtime'];?></td>
              <td width="8%" align="center" class="left_txt">&nbsp;
              </td>
            </tr>
            <?php 
            }
            ?>
            <tr>
              <td colspan="6" align="center" class="left_txt">&nbsp;</td>
            </tr>
              <tr>
                <td>                
              </form>
          </table>
          </td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
</body>
</html>
